import { connect } from 'react-redux'
import { actions } from 'react-native-navigation-redux-helpers'

import { openDrawer } from '../redux/actions/drawer'
import { onTabPress } from '../redux/actions/footer'
import Home from '../components/home'

const {
  reset
} = actions

const bindAction = (dispatch) => ({
  onLeftBtnPress: (navigation) => dispatch(reset([{ key: 'login' }], navigation.key, 0)),
  onRightBtnPress: () => dispatch(openDrawer()),
  onTabPress: (tab) => dispatch(onTabPress(tab))
  // pushRoute: (route, key) => dispatch(pushRoute(route, key)),
})

const mapStateToProps = state => ({
  navigation: state.cardNavigation,
  footer: state.footer
})

export default connect(mapStateToProps, bindAction)(Home)
